<template>
  <view
    class="content"
    :style="{
      'padding-top': height + 'px',
    }"
  >
    <view
      :style="{
        height: statusBarHeight + 'px',
      }"
    >
    </view>
    <!-- 头部 -->
    <view
      class="head"
      :style="{
        top: statusBarHeight + 'px',
        background: isHeadBack ? 'rgba(0,0,0,0.3)' : 'rgba(0,0,0,0)',
      }"
    >
      <view class="head_left">
        <u-icon
          name="arrow-left"
          color="#EEEEEE"
          size="24"
          :bold="true"
          @click="toBack"
        ></u-icon>
      </view>
      <view class="text">提现</view>
    </view>

    <view class="box">
      <view class="box_card">
        <view class="box_card_title">可提现金额</view>
        <view class="box_card_price">
          <view class="box_card_price_unit">￥</view>
          <view class="box_card_price_num">{{assets.balance}}</view>
        </view>
        <view class="box_card_freeze">冻结金额：￥{{assets.dongjie}}</view>
      </view>

      <view class="box_bot">
        <view class="box_bot_title">提现金额</view>
        <view class="box_bot_input"> 
            <view class="box_bot_input_unit">￥</view>
            <u--input
                class="box_item_input"
                placeholder="请输入要提现的金额"
                border="none"
                v-model="price"
                placeholderStyle="color:#888888;font-size:30rpx"
                color="#888888"
            ></u--input>
            <view class="box_bot_btn" @click="allWithdrawal">全部提现</view>
        </view>
        <view class="box_bot_input"> 
            <u--input
                class="box_item_input"
                placeholder="请输入提现方式"
                border="none"
                v-model="way"
                placeholderStyle="color:#888888;font-size:30rpx"
                color="#888888"
            ></u--input>
        </view>
        <view class="box_bot_input"> 
            <u--input
                class="box_item_input"
                placeholder="请输入提现账号"
                border="none"
                v-model="number"
                placeholderStyle="color:#888888;font-size:30rpx"
                color="#888888"
            ></u--input>
        </view>
      </view>

      <view class="bottom_btn" @click="subFn">提交申请</view>
    </view>


    <floatingBall></floatingBall>
  </view>
</template>
          
          <script>
export default {
  components: {},

  data() {
    return {
      statusBarHeight: 0,
      height: 0,
      isHeadBack: false,
      price:'',
      way:'',
      number:'',
      assets:{},

    };
  },
  created() {
    const statusBarHeight = uni.getSystemInfoSync(); // 获取手机状态栏高度

    this.statusBarHeight = statusBarHeight.statusBarHeight;
    this.$nextTick(() => {
      uni
        .createSelectorQuery()
        .select(".head")
        .boundingClientRect((data) => {
          this.height = data.height;
        })
        .exec();
    });
    this.getAssets()
  },
  methods: {
    toBack() {
      uni.navigateBack({
        delta: 1,
      });
    },
    subFn(){
      if(this.price == ''){
        return uni.$u.toast('请输入提现金额');
      } else if(this.way == ''){
        return uni.$u.toast('请输入提现方式');
      } else if(this.number == ''){
        return uni.$u.toast('请输入提现账号');
      }
      this.$http
        .userTixian({ number:this.price,information:this.way + ':' + this.number})
        .then((res) => {
          console.log(res.message, "申请提现");
          this.getAssets()
          this.price = ''
          this.way = ''
          this.number = ''
          uni.$u.toast(res.message);
        })
        .catch((error) => {
          uni.$u.toast(error);
        });
    },
    allWithdrawal(){
      this.price = this.assets.balance
    },
    // 账户钱包余额
    getAssets(){
      this.$http
        .userAssets({ })
        .then((res) => {
          console.log(res.data.assets, "账户钱包余额");
          this.assets = res.data.assets
        })
        .catch((error) => {
          uni.$u.toast(error);
        });
    }
  },
};
</script>
          
          <style scoped lang="scss">
.content {
  background: #111111;
  box-sizing: border-box;
  // background: url("/static/images/my/pic_wdjf_bwijing.png") no-repeat;
  // background-size: 100% auto;
  // background-attachment: fixed;
  z-index: -10;
  display: flex;
  flex-direction: column;
}

.head {
  width: 100%;
  padding: 18rpx 30rpx 47rpx;
  position: fixed;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  z-index: 99;
  background: #ffffff;
  .head_left {
    position: absolute;
    left: 30rpx;
  }

  .head_right {
    position: absolute;
    right: 30rpx;
    color: #ffffff;
    font-size: 30rpx;
  }

  .text {
    font-size: 36rpx;
    font-family: PingFang SC-Bold, PingFang SC;
    font-weight: 400;
    color: #eeeeee;
  }
}
.box {
  padding: 30rpx;
  .box_card {
    background: url("/static/images/my/pic-wdqb_qianbao.png") no-repeat;
    background-size: 100% 100%;
    padding: 53rpx 40rpx;
    box-sizing: border-box;
    .box_card_title {
      font-size: 24rpx;
      color: #666666;
    }
    .box_card_price {
      color: #272727;
      margin-top: 16rpx;
      .box_card_price_unit {
        font-size: 40rpx;
        display: inline-block;
      }
      .box_card_price_num {
        font-size: 60rpx;
        display: inline-block;
      }
    }
    .box_card_freeze {
      font-size: 26rpx;
      color: #666666;
      margin-top: 24rpx;
    }
    .box_card_bot {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      margin-top: 25rpx;
      .box_card_btn {
        width: 180rpx;
        height: 64rpx;
        background: linear-gradient(
          180deg,
          #5aaf91 0%,
          rgba(90, 175, 145, 0.48) 100%
        );
        border-radius: 32rpx;
        font-size: 28rpx;
        color: #ffffff;
        text-align: center;
        line-height: 64rpx;
      }
    }
  }
  .box_bot {
    background: #272727;
    border-radius: 24rpx;
    padding: 32rpx;
    box-sizing: border-box;
    margin-top: 32rpx;
    padding-bottom: 45rpx;
    .box_bot_title {
      font-size: 30rpx;
      color: #ffffff;
    }
    .box_bot_input {
      background: #3d3d3d;
      border-radius: 16rpx;
      display: flex;
      align-items: center;
      padding: 18rpx 32rpx;
      margin-top: 20rpx;
      .box_bot_input_unit{
        font-size: 40rpx;
        color: #FFFFFF;
      }
      .box_item_input{
        margin-left: 23rpx !important;
        margin-right: 23rpx !important;
      }
      .box_bot_btn{
        font-size: 30rpx;
        color: #55B877;
    }
    }
    
  }

  .bottom_btn {
    width: 630rpx;
    height: 96rpx;
    background: linear-gradient(360deg, #50b674 0%, #aeddbd 100%);
    border-radius: 48rpx;
    text-align: center;
    line-height: 96rpx;
    font-size: 30rpx;
    color: #ffffff;
    margin: 0 auto;
    margin-top: 96rpx;
  }
}
</style>